# aClass就是被装饰的类
def shuoGG(aClass):
    def onCall(*args, **kargs):
        print('Before instance created')
        obj = aClass(*args, **kargs)
        print('After instance created')
        return obj
    return onCall


class Person:
    def __init__(self):
        print('I am a person')


@shuoGG
class Boy(Person):
    def __init__(self):
        # 用到类装饰器的话,被装饰的类不能用super(Boy,self).__init__(), 只能用Person.__init__(self)
        Person.__init__(self)
        print('Constructor activated!')

    def play(self):
        print('Playing God of War...')


if __name__ == '__main__':
    xiaoming = Boy()
    xiaoming.play()
